﻿using Castle.MicroKernel.Registration;
using Castle.Windsor;

namespace IOCSample
{
    public class WindsorRunner : RunnerBase, IRunner
    {
        protected override string Name
        {
            get { return "Castle Windsor"; }
        }

        public void Start(RunType runType)
        {
            var container = new WindsorContainer();
            if (runType == RunType.Singleton)
                container.Register(Component.For(typeof(IRunner)).LifeStyle.Singleton.ImplementedBy(typeof(WindsorRunner)));
            else
                container.Register(Component.For(typeof(IRunner)).ImplementedBy(typeof(WindsorRunner)));

            Time(() =>
            {
                var manager = container.Resolve<IRunner>();
            });
        }
    }
}
